#include "stdafx.h"
#include "wf_modifydelete.h"

#include "wf_selectsingle.h"
#include "pf_modification.h"
#include "pf_snapper.h"
#include "pf_point.h"



WF_ModifyDelete::WF_ModifyDelete(PF_Container& container,
        PF_GraphicView& graphicView)
        :PF_ActionInterface("Delete Entities",
                    container, graphicView) {}

QAction* WF_ModifyDelete::createGUIAction(LX_Define::ActionType /*type*/, QObject* /*parent*/) {
	// tr("Delete")
    QAction* action = new QAction(tr("&Delete"),  NULL);
	action->setIcon(QIcon(":/extui/modifydelete.png"));
    //action->zetStatusTip(tr("Delete Entities"));
	//action->setShortcut(QKeySequence::Delete);
    return action;
}


void WF_ModifyDelete::init(int status) {
    PF_ActionInterface::init(status);

    trigger();
}



void WF_ModifyDelete::trigger() {

    PF_DEBUG->print("PF_ActionModifyDelete::trigger()");

    PF_Modification m(*container, graphicView);
    m.remove();

    finish();

    if (PF_DIALOGFACTORY!=NULL) {
        PF_DIALOGFACTORY->updateSelectionWidget(container->countSelected());
    }
}



void WF_ModifyDelete::updateMouseButtonHints() {
    if (PF_DIALOGFACTORY!=NULL) {
        switch (getStatus()) {
            //case Acknowledge:
            //    PF_DIALOGFACTORY->updateMouseWidget(tr("Acknowledge"),
            //	tr("Cancel"));
            //    break;
        default:
            PF_DIALOGFACTORY->updateMouseWidget("", "");
            break;
        }
    }
}



void WF_ModifyDelete::updateMouseCursor() {
    graphicView->setMouseCursor(LX_Define::DelCursor);
}



void WF_ModifyDelete::updateToolBar() {
    if (PF_DIALOGFACTORY!=NULL) {
        if (!isFinished()) {
            PF_DIALOGFACTORY->requestToolBar(LX_Define::ToolBarModify);
        } else {
            PF_DIALOGFACTORY->requestToolBar(LX_Define::ToolBarMain);
        }
    }
}


// EOF
